package _4_prototype

// Cloneable 克隆接口 标记类型可clone
type Cloneable interface {
	cloneable() bool
}

type CloneableImpl struct {
}

func (c *CloneableImpl) cloneable() bool {
	return true
}

type DeliverTask struct {
	CloneableImpl
	targetAddr string
}

//func (d *DeliverTask) cloneable() bool {
//	return true
//}

//赋值的方式实现clone
func (d *DeliverTask) clone() *DeliverTask {
	return &DeliverTask{targetAddr: d.targetAddr + "_clone"}
}

//赋值的方式实现clone
func (d *DeliverTask) clone2() DeliverTask {
	return DeliverTask{targetAddr: d.targetAddr + "_clone"}
}
